const { src, dest } = require('gulp');
const less = require('gulp-less');
const plumber = require('gulp-plumber');
const notify = require('gulp-notify');
const minifyCSS = require('gulp-minify-css');

// less 解析
function goless() {
    return src('src/less/*.less')
        .pipe(plumber({ errorHandler: notify.onError('Error: <%= error.message %>') })) // 解析错误提示
        .pipe(less())
        .pipe(minifyCSS())
        .pipe(dest('dist/css'));
}

module.exports = goless